# Contributor: TBK <alpine@jjtc.eu>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php8-brotli
_extname=brotli
pkgver=0.11.1
pkgrel=1
pkgdesc="Brotli Extension for PHP 8.0"
url="https://github.com/kjdev/php-ext-brotli"
arch="all"
license="MIT"
depends="php8-common"
makedepends="php8-dev brotli-dev"
checkdepends="php8-cgi"
source="php-$_extname-$pkgver.tar.gz::https://github.com/kjdev/php-ext-brotli/archive/$pkgver.tar.gz"
builddir="$srcdir/php-ext-brotli-$pkgver"

build() {
	phpize8
	./configure \
		--prefix=/usr \
		--with-php-config=php-config8 \
		--with-libbrotli # Use system lib
	make
}

check() {
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 SKIP_ONLINE_TESTS=1 test \
		TEST_PHP_CGI_EXECUTABLE=/usr/bin/php-cgi8 TESTS=--show-diff
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/php8/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/50_$_extname.ini
}

sha512sums="4d73ea67311399c08334c71c6b908d37739ca7e78670506180ff6d8288dc235fbc750b95197a993adf2c1f413a7f734681a283f6c57b6069cf145d9dfd890d4a  php-brotli-0.11.1.tar.gz"
